package cn.highset.modules.base.serviceimpl;

import cn.highset.modules.base.dao.ContentDao;
import cn.highset.modules.base.entity.Content;
import cn.highset.modules.base.service.ContentService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 富文本内容接口实现
 *
 * @author Victor
 */
@Slf4j
@Service
@Transactional
public class ContentServiceImpl implements ContentService {

    @Autowired
    private ContentDao contentDao;

    @Override
    public ContentDao getRepository() {
        return contentDao;
    }

    @Override
    public Content findByType(String type) {
        List<Content> list = contentDao.findByType(type);
        if (list != null && list.size() > 0) {
            return list.get(0);
        }
        return null;
    }
}
